import { Component } from '@angular/core';
import {HttpClient} from '@angular/common/http'

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  constructor(public http:HttpClient){}
  title = 'wyy-huayu';
  musics:Array<Object> = []
  ngOnInit(){
    var url:string = "http://localhost:3000/top/playlist?cat=华语";
    this.http.get(url).subscribe((res:any)=>{
      this.musics = res.playlists;
      console.log(this.musics);
    })
  }
}
